package com.example.webpractice.utils;

/**
 * 返回值枚举
 */
public enum ResponseEnum implements ResponseCode {
    /**
     * ok
     */
    OK(0, "操作成功"),
    internalFail(10000, "内部错误"),
    loginFail(1, "密码错误"),
    accountNotFound(2, "用户名不存在"),
    accountFound(3, "用户名已经存在"),
    fenleiFound(4, "分类已经存在"),
    updateFail(5, "更新失败"),
    deleteFail(6, "删除失败"),
    classFail(7, "课程已经存在"),
    uploadFail(8, "文件为空"),
    kechengExsit(8, "课程已经存在"),
    notImplement(9, "接口未实现");
    private final Integer code;

    private final String msg;

    ResponseEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public Integer value() {
        return code;
    }

    @Override
    public boolean isOk() {
        return this == ResponseEnum.OK;
    }

    @Override
    public String toString() {
        return "ResponseEnum{" + "code='" + code + '\'' + ", msg='" + msg + '\'' + "} " + super.toString();
    }

}
